package com.ygqh.baby.utils;

import com.ygqh.baby.ao.SalesPlatform;
import com.ygqh.baby.constant.Constant;

/**
 * 〈〉
 *
 * @author guohao
 * @date 2019/5/21 15:07
 * @since 1.0.0
 */
public class PlatformUtil {

    public static String[] getPlatformNos(SalesPlatform salesPlatform) {
        if (SalesPlatform.Yijiadian.equals(salesPlatform)) {
            return new String[]{"All", Constant.YIJIADIAN_PLATFORM_NO};
        } else if (SalesPlatform.Yiigoo.equals(salesPlatform)) {
            return new String[]{"All", Constant.YIIGOO_PLATFORM_NO};
        } else {
            return new String[]{"All"};
        }
    }

    public static String[] getPlatformNos(String platformNo) {
        if (Constant.YIJIADIAN_PLATFORM_NO.equals(platformNo)) {
            return new String[]{"All", Constant.YIJIADIAN_PLATFORM_NO};
        } else if (Constant.YIIGOO_PLATFORM_NO.equals(platformNo)) {
            return new String[]{"All", Constant.YIIGOO_PLATFORM_NO};
        } else {
            return new String[]{"All"};
        }
    }

    public static String getPlatformNo(SalesPlatform salesPlatform) {
        if (SalesPlatform.Yiigoo.equals(salesPlatform)) {
            return Constant.YIIGOO_PLATFORM_NO;
        } else if (SalesPlatform.Yijiadian.equals(salesPlatform)) {
            return Constant.YIJIADIAN_PLATFORM_NO;
        } else {
            return SalesPlatform.All.name();
        }
    }

    public static SalesPlatform converte(String platformNo) {
        SalesPlatform salesPlatform = null;
        if (Constant.YIJIADIAN_PLATFORM_NO.equals(platformNo)) {
            salesPlatform = SalesPlatform.Yijiadian;
        } else if (Constant.YIIGOO_PLATFORM_NO.equals(platformNo)) {
            salesPlatform = SalesPlatform.Yiigoo;
        }
        return salesPlatform;
    }
}
